package servlet;

import com.db.conn;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class placard_Add extends HttpServlet {

	
	public placard_Add() {
		super();
	}


	public void destroy() {
		super.destroy(); 
	}

	//添加通知公告信息
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html;");
		PrintWriter out = response.getWriter();

         //声明数据库操作类
		conn cn = new conn();
	
	    //接收传递过来的值
        String ptitle=request.getParameter("txt_ptitle");
        String pmemo=request.getParameter("Textarea1");


        String sql="insert into placard(ptitle,pmemo,ptime) values('"+ptitle+"','"+pmemo+"',now())";

		//执行sql
		cn.update(sql);		

		out.println("<script>");
		out.println("alert('操作成功');");
		out.println("window.location='admin/placard/placard_Add.jsp'");
		out.println("</script>");
	
		out.flush();
		out.close();
	}


	public void init() throws ServletException {
		// Put your code here
	}

}

